from celery_tasks.main import celery_app
# 导入SmsSDK
from ronglian_sms_sdk import SmsSDK

# SmsSDK里的配置信息 配置信息在自己的容联云的配置信息
# [容联云](https://www.yuntongxun.com/)
accId = "8aaf0708827c8fd50182a47dc22a0645"
authToken = "7ab03dfd9f5042a8951de808b9331189"
appId = "8aaf0708827c8fd50182a47dc385064c"


@celery_app.task
def sms_code(code, mobile, expire=5):
    sdk = SmsSDK(accId, authToken, appId)
    tid = '1'
    datas = ("%s" % code, "%s" % expire)

    # 发送请求
    res = sdk.sendMessage(tid=tid, mobile=mobile, datas=datas)
    return res
